Owned Resources
Owned Resources How Drivers and DA's Find Their Owned Resources
When device drivers, desk accessories (which are a special type of device
driver) and certain other resource types are loaded into the system, they are
re numbered to avoid conflicts with other resources of the same type. For
example, the Font/DA Mover re numbers a desk accessory if it finds an other
desk accessory of type 'DRVR' with the same ID already loaded into the system.
Not only does the 'DRVR' resource need to be re numbered, so do all of its other
"owned" resources such as 'STR ', 'WIND', and any other resources needed by
the desk accessory.
Apple uses a special numbering convention to associate owned resources with
the resources that own them. The following diagram shows how to compute the
resource ID of an owned resource.
Bits 14 and 15 are always 1. Bits 11-13 specify the type of the owning
resource. Valid type bits are as follows:
Type bits Type
000 'DRVR'
001 'WDEF'
010 'MDEF'
011 'CDEF'
100 'PDEF'
101 'PACK'
110 Reserved for future use
111 Reserved for future use
Bits 5-10 contain the resource ID of the owning resource. Note that since
there are only 6 bits to use, the range of valid ID's for all device drivers
( including desk accessories) is 0 - 63. Bits 0 - 4 are the sub-ID, and contain
any desired value (0 through 31).
Because the ID's of owned resources might change from run to run of the
driver (or other owning type of resource), the ID of the owned resource must
be recalculated before it is referenced.

Notes: The Font/DA Mover does its best to keep resources pointing at each other
properly. This means that it tries to renumber embedded resource ID's in
other resources as well as the resources themselves. For example, a 'DITL'
resource within a 'DLOG' would get changed automatically by the Font/DA
Mover. The Font/DA Mover knows about the standard embedded resource ID's
in most of the standard resources. If your program contains custom
embedded resources, you will have to renumber them on your own. The
embedded resource ID's recognized by Font/DA Mover version 3.3 and later
are:
references to 'DITL' resources in 'DLOG' and 'ALRT' resources
references to 'ICON', 'PICT', 'CNTL' in 'DITL' resources
references to 'MENU' resources in the resources themselves (menuID
field)
references to 'MENU' resources in 'MBAR' resources
Any resource types not in this list should be fixed by the desk accessory at
run time.
Before there was a Font/DA Mover, desk accessories could have ID's in the
range of 12 to 31. All desk accessories now must have ID's in the range of 12 to
26. Apple reserves numbers 27 through 31 for itself.
Example
#include <Resources.h>
DCtlPtr dce; /* device control entry, passed to DA via main entry point */
/* OwnedResourceID - Compute the resource ID of a resource owned by DA */
short OwnedResourceID( short n)
{
return ( 0xC000 + ((~dce->dCtlRefNum))<<5) + n);
}